package cate.game.train.rune.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "徽章重铸保存 の 请求")
public class RuneRecastSaveReq implements MsgInput {
    @NoteField(value = "徽章ID", detail = "需要保存重铸的徽章")
    public String runeUid;

    @NoteField(value = "英雄ID", detail = "如果重铸的是英雄身上的徽章还需要传英雄id")
    public String heroUid;

    @NoteField(value = "部位", detail = "如果是英雄身上的徽章还需要传部位id")
    public byte pos;

    @NoteField(value = "重铸保存类型", detail = "0：全部保存 1:只保存技能 2:只保存属性")
    public byte type;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult r = game.train.rune.recastSave(cc.getRole(), runeUid, heroUid, pos, type);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r, true);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.RUNE_RECAST_SAVE_REQ;
    }
}
